// pages/home/home.js
import {
  showText
} from "../../utils/util"
import {
  gemoSpaceList
} from '@/api/spaceIntroduce';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUri: getApp().globalData.imgUri,
    cdn:getApp().globalData.cdn,
    swiper2Index:0,
    gemoSpaceListData:[],
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let t = this;
    gemoSpaceList({}).then((res) => {
      if (res.code == 200) {
        let rows = res.rows;
        for(var i=0;i<rows.length;i++){
          var spaceData = rows[i].spaceData;
          rows[i].spaceData = JSON.parse(spaceData);
        }
        t.setData({
          gemoSpaceListData:rows
        });
      }
    })
  },
  tiao(){
    wx.navigateTo({
      url: '/pages/space/space',
    })
  },
  changeSwiper2(e){
    this.setData({
      swiper2Index:e.detail.current
    })
  },
  onShareAppMessage() {
    return {
      title: getApp().globalData.share_title,
      path: getApp().globalData.share_url,
      imageUrl: getApp().globalData.share_image,
    }
  }
})